package org.candyteam.lgw.framework;

import java.util.ArrayList;
import java.util.List;

public class TestResult {

    private int count;
    private final List<Throwable> testErrors;

    public TestResult() {
        this.count = 0;
        this.testErrors = new ArrayList<>();
    }

    public void addTestError(Exception e) {
        testErrors.add(e);
    }

    public void testFinished() {
        this.count++;
    }

    public boolean wasSuccessful() {
        return getFailureCount() == 0;
    }

    public int getFailureCount() {
        return testErrors.size();
    }

    @Override
    public String toString() {
        return "TestResult{\n" +
                "\tcount = " + count +
                "\n\tfailure = " + testErrors.size() +
                "\n\ttestErrors=" + testErrors +
                "\n}";
    }
}
